# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1PredictRequestResponseLoggingConfig do
  @moduledoc """
  Configuration for logging request-response to a BigQuery table.

  ## Attributes

  *   `bigqueryDestination` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1BigQueryDestination.t`, *default:* `nil`) - BigQuery table for logging. If only given a project, a new dataset will be created with name `logging__` where will be made BigQuery-dataset-name compatible (e.g. most special characters will become underscores). If no table name is given, a new table will be created with name `request_response_logging`
  *   `enabled` (*type:* `boolean()`, *default:* `nil`) - If logging is enabled or not.
  *   `samplingRate` (*type:* `float()`, *default:* `nil`) - Percentage of requests to be logged, expressed as a fraction in range(0,1].
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :bigqueryDestination =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1BigQueryDestination.t() | nil,
          :enabled => boolean() | nil,
          :samplingRate => float() | nil
        }

  field(:bigqueryDestination,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1BigQueryDestination
  )

  field(:enabled)
  field(:samplingRate)
end

defimpl Poison.Decoder,
  for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1PredictRequestResponseLoggingConfig do
  def decode(value, options) do
    GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1PredictRequestResponseLoggingConfig.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1PredictRequestResponseLoggingConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
